package com.jerry.wschat.service;

import com.jerry.wschat.dao.UserDao;
import com.jerry.wschat.model.User;
import com.jerry.wschat.model.vo.UserVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Jerry.Wu
 * @description:
 * @date 2018/9/12 18:40
 */
@Service
public class UserServiceImpl extends BaseServiceImpl<User, Integer> implements UserService {

    @Autowired
    private UserDao mUserDao;

    @Override
    public User findUserByUsername(String username) {
        return mUserDao.findUserByUsername(username);
    }

    @Override
    public UserVO loadUserVO(Integer id) {
        User user = load(id);
        UserVO userVO = new UserVO();
        BeanUtils.copyProperties(user, userVO);
        return userVO;
    }

}
